GtkWidget: Create GtkStyle on top of GtkStyleContext.
authorCarlos Garnacho <carlosg@gnome.org>
Mon, 2 Aug 2010 14:14:17 +0000 (16:14 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Sat, 4 Dec 2010 14:37:26 +0000 (15:37 +0100)
gtk/gtkwidget.c

index 8cca7a07dda7bb70d7b58c3991c0fb3cb98f4ca2..5de120fc9bf7b02cbc53ad4c4a3f79b123bbbd2e 100644 (file)
@@ -7286,7 +7286,7 @@ gtk_widget_set_parent (GtkWidget *widget,
     }
 
   context = g_object_get_qdata (G_OBJECT (widget),
-                                    quark_style_context);
+                                quark_style_context);
   if (context)
     {
       GtkWidgetPath *path;
@@ -7420,8 +7420,22 @@ gtk_widget_ensure_style (GtkWidget *widget)
 {
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
+  if (!widget->priv->style ||
+      !gtk_style_has_context (widget->priv->style))
+    {
+      GtkStyle *style;
+
+      style = g_object_new (GTK_TYPE_STYLE,
+                            "context", gtk_widget_get_style_context (widget),
+                            NULL);
+
+      gtk_widget_set_style_internal (widget, style, TRUE);
+    }
+
+#if 0
   if (!widget->priv->rc_style && !widget->priv->user_style)
     gtk_widget_reset_rc_style (widget);
+#endif
 }
 
 /* Look up the RC style for this widget, unsetting any user style that